package com.xyz.gulimall.ware.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xyz.common.utils.PageUtils;
import com.xyz.common.utils.Query;

import com.xyz.gulimall.ware.dao.WareSkuDao;
import com.xyz.gulimall.ware.entity.WareSkuEntity;
import com.xyz.gulimall.ware.service.WareSkuService;


@Service("wareSkuService")
public class WareSkuServiceImpl extends ServiceImpl<WareSkuDao, WareSkuEntity> implements WareSkuService {



     @Override
     public PageUtils queryPage(Map<String, Object> params) {
         QueryWrapper<WareSkuEntity> queryWrapper = new QueryWrapper<>();
         String key = (String) params.get("skuId");
         if(!StringUtils.isEmpty(key)){
             queryWrapper.eq("sku_id",key);
         }
         String wareId = (String) params.get("wareId");
         if(!StringUtils.isEmpty(key)){
             queryWrapper.eq("ware_id",key);
         }
         IPage<WareSkuEntity> page = this.page(
                      new Query<WareSkuEntity>().getPage(params),
                      queryWrapper
              );
              return new PageUtils(page);
     }

}